-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mono] Use correct cast_class for IntPtr[] #103841
Conversation
This change fixes the behavior to be like modern .NET instead of .NET Framework. Fixes dotnet#97145
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks right, but I'm not 100% certain.
I wonder if there's any tests that capture the modern behavior that we previously disabled in Mono. |
cc @BrzVlad is this going to cause any problems for interp? |
This seems to have crashed on ios/tvos device runs. I ran @lambdageek's sample locally at least works for iossimulator. I'll try on a local device and see if I can get any info out of it. |
@@ -1039,18 +1039,14 @@ class_composite_fixup_cast_class (MonoClass *klass, gboolean for_ptr) | |||
case MONO_TYPE_U2: | |||
klass->cast_class = mono_defaults.int16_class; | |||
break; | |||
case MONO_TYPE_U4: | |||
#if TARGET_SIZEOF_VOID_P == 4 | |||
case MONO_TYPE_I: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MONO_TYPE_BOOLEAN
-> byte_class
normalization above looks suspect as well. I do not think regular CoreCLR does normalization like that anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkotas I think the bool -> int8
fixup comes from when I misread I.8.7.2:
A location type T is compatible-with a location type U if and only if one of the following holds.
- T and U are not managed pointer types and T is compatible-with U according to the definition in §I.8.7.1.
- T and U are both managed pointer types and T is pointer-element-compatible-with U.
A managed pointer type T is pointer-element-compatible-with a managed pointer type U if and
only if T has verification type V and U has verification type W and V is identical to W.
The verification type of a bool is defined in I.8.7 as
- If the reduced type of T is:
a. int8 or bool, then its verification type is int8.
The problem is I think I applied the verification type rules to unmanaged pointer types (ie bool*
) rather than to managed pointer types (ie bool&
)
Weird, local device runs are fine. |
Appears there's some infra issues with the tvos and ios device legs. I validated system.runtime tests on a local device. |
This change fixes the behavior to be like modern .NET instead of .NET Framework.
Fixes #97145